﻿Imports System.Windows.Forms

Public Class AllocationLinesDialog

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        If IDBox.Text = "" Then
            MessageBox.Show("ID cannot be blank", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            IDBox.Focus()
            Exit Sub
        End If

        If DescriptionBox.Text = "" Then
            MessageBox.Show("Description cannot be blank", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            DescriptionBox.Focus()
            Exit Sub
        End If

        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Public Sub LoadFieldBox()
        Dim sql As String

        sql = "select Field_Code, Field_Description, order_Field from Fields_List_Part " & _
              "union select 0, '<None>', 0 from global_settings_Upgrade " & _
              "order by Order_Field"

        FieldBox.DataSource = LoadDataView(sql)
        FieldBox.ValueMember = "Field_Code"
        FieldBox.DisplayMember = "Field_Description"
    End Sub

    Private Sub AllocationLinesDialog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
